package smartcampus.scjava.custom;

/**
 * @author xian
 * @description 座位时间枚举类
 * @createTime 2023/11/27 20:56
 */
public enum SeatTimeEnum {
    ONE(8,1),
    TWO(9,2),
    THREE(10,3),
    FOUR(11,4),
    FIVE(12,5),
    SIX(13,6),
    SEVEN(14,7),
    EIGHT(15,8),
    NINE(16,9),
    TEN(17,10),
    ELEVEN(18,11),
    TWELVE(19,12),
    THIRTEEN(20,13),
    FOURTEEN(21,14);


    SeatTimeEnum(int hour,int index) {
        this.hour = hour;
        this.index = index;
    }

    private  int hour;
    private  int index;

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public static int getIndex(int hour) {
        for (SeatTimeEnum seatTimeEnum : SeatTimeEnum.values()) {
            if (seatTimeEnum.getHour() == hour) {
                return seatTimeEnum.getIndex();
            }
        }
        return 0;
    }

    public static int getHour(int index) {
        for (SeatTimeEnum seatTimeEnum : SeatTimeEnum.values()) {
            if (seatTimeEnum.getIndex() == index) {
                return seatTimeEnum.getHour();
            }
        }
        return 0;
    }
}
